class Page1 extends BaseScreen {
    public constructor() {
        super();
        this.skinName = "resource/eui_skins/Page1Skin.exml";
    }

	private p_1: eui.Image;
    private p_2: eui.Image;
    private p_3: eui.Image;
	private p_1_x:number;
    private p_3_y:number;
	private p_5_x:number;
    private img_bg:eui.Image;
	
	protected childrenCreated(): void {
        super.childrenCreated();
        this.init_view();
    }

    public init_view() {
        this.page_mode = '';
        this.p_1_x = this.p_1.x;
        this.p_3_y = this.p_3.y;
		// this.p_4.mask = this.p_4_mask;
		// this.p_5.mask = this.p_5_mask;
		// this.p_4_x = this.p_4.x;
		// this.p_5_x = this.p_5.x;
		
        this.resetui();
        this.showPage();
    }

	public resetui(){
		this.p_1.x = -this.p_1.width;
		this.p_2.x = this.width;
		this.p_3.alpha = 0.3;

        // this.p_4.alpha = 0.3;
        // this.p_5.alpha = 0;
    }


    public showPage() {
        egret.Tween.removeTweens(this);
        if (this.is_start_mv) {
            return;
        }
        this.is_start_mv = true;

        this.resetui();
		egret.Tween.get(this.p_1).to({x:this.p_1_x}, 600,egret.Ease.backOut);
		egret.Tween.get(this.p_2).wait(300).to({x:0}, 800,egret.Ease.backOut);
        let self = this;
        egret.Tween.get(this.p_3).to({alpha:1}, 2500).call(function(){
            egret.Tween.get(self.p_3,{loop:true}).to({y:self.p_3.y+10}, 2000).to({y:self.p_3_y}, 2000)
        });

        // egret.Tween.get(this.p_4).to({alpha:1}, 700)
        // egret.Tween.get(this.p_5).to({alpha:1}, 700)

		// egret.Tween.get(this.p_4,{loop:true}).to({ scaleX:1.1,scaleY:1.1}, 2000).to({ scaleX:1,scaleY:1}, 2000);
		// egret.Tween.get(this.p_5,{loop:true}).to({ scaleX:1.1,scaleY:1.1}, 2000).to({ scaleX:1,scaleY:1}, 2000);
	}

	public resize(): void {
        super.resize();

        if (this.height > 1138) {
           this.img_bg.height = this.height;
        }
        
	}
}